package com.busionline.wotu.woochenandroid.views;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.busionline.wotu.baselibrary.navigation.bottom.TabItemView;
import com.busionline.wotu.woochenandroid.R;


/**
 *演示使用类
 *@author chenwuchao
 *@time 2017/11/23 10:20
 *@desc
 */

public class TabMainItemView extends TabItemView<TabMainItemView.Builder> {
    private TabMainItemView(Builder builder) {
        super(builder);
    }

    @Override
    protected void initView() {
        setText(R.id.tv_tab_name, build.tabName);
        setImageRes(R.id.tv_tab_pic,build.resId);
    }


    @Override
    public void setSelected(boolean selected) {
        TextView textView = getView(R.id.tv_tab_name);
        ImageView imageView = getView(R.id.tv_tab_pic);
        textView.setSelected(selected);
        imageView.setSelected(selected);
    }

    public static class Builder extends TabItemView.Builder {
        private String tabName;
        private int resId;

        public Builder(Context context) {
            super(context);
            this.layoutId = R.layout.tab_main_item;
        }

        public Builder setText(String msg) {
            this.tabName = msg;
            return this;
        }

        public Builder setImage(int resId) {
            this.resId = resId;
            return this;
        }

        @Override
        public TabMainItemView build() {
            TabMainItemView tabMainItemView = new TabMainItemView(this);
            return tabMainItemView;
        }

    }

}
